home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 7.3 KB | 263 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawCmds.h
- // Release Version: $ 1.0d11 $
- //
- // Author: Mary Boetcher
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef DRAWCMDS_H
- #define DRAWCMDS_H
-
- // ----- FrameWork Includes -----
-
- #ifndef FWCMD_H
- #include "FWCmd.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWCOLOR_H
- #include "FWColor.h"
- #endif
-
- #ifndef FWPAT_H
- #include "FWPat.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
- class FW_CLASS_ATTR FW_CFrame;
- class FW_CLASS_ATTR FW_CPrivOrderedCollection;
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- class FW_CLASS_ATTR CBaseShape;
- class FW_CLASS_ATTR CDrawPart;
- class FW_CLASS_ATTR CDrawFrame;
- class FW_CLASS_ATTR CDrawSelection;
-
- //========================================================================================
- // Constants - Command numbers
- //========================================================================================
-
- const ODCommandID cDrawShapeCommand = 3000;
- const ODCommandID cChangeFillColor = 3001;
- const ODCommandID cChangeFillPattern = 3002;
- const ODCommandID cChangeFrameColor = 3003;
- const ODCommandID cChangeFramePattern = 3004;
- const ODCommandID cChangeRenderVerb = 3005;
- const ODCommandID cResizeCommand = 3006;
-
- //========================================================================================
- // class CDrawShapeCommand - Draw a new shape and add it to the document
- //========================================================================================
-
- class FW_CLASS_ATTR CDrawShapeCommand : public FW_CCommand
- {
- public:
-
- CDrawShapeCommand(Environment* ev,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection,
- CBaseShape* newShape);
-
- virtual ~ CDrawShapeCommand();
-
- // --- Command overrides
- virtual void DoIt(Environment* ev); // Override
- virtual void UndoIt(Environment* ev); // Override
- virtual void RedoIt(Environment* ev); // Override
- virtual void CommitUndone(Environment* ev); // Override
-
- protected:
- CBaseShape* fNewShape;
- CDrawPart* fDrawPart;
- CDrawSelection* fDrawSelection;
-
- void SelectSavedShape(Environment* ev);
- };
-
- //========================================================================================
- // class CResizeShapeCommand - Change size of selected shapes
- //========================================================================================
-
- class FW_CLASS_ATTR CResizeShapeCommand : public FW_CCommand
- {
- public:
-
- CResizeShapeCommand(Environment* ev,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection,
- const FW_CRect& srcRect,
- const FW_CRect& dstRect);
-
- virtual ~ CResizeShapeCommand();
-
- // --- Command overrides
- virtual void DoIt(Environment* ev); // Override
- virtual void UndoIt(Environment* ev); // Override
- virtual void RedoIt(Environment* ev); // Override
- virtual void SaveUndoState(Environment* ev); // Override
-
- protected:
- void Redraw(Environment* ev);
- void SelectChangedShapes(Environment* ev);
-
- protected:
- CDrawPart* fDrawPart;
- FW_CFrame* fFrame;
- CDrawSelection* fDrawSelection;
- FW_CRect fSourceRect;
- FW_CRect fDestRect;
- ODShape* fUpdateShape;
- FW_CPrivOrderedCollection* fChangedShapeList;
- };
-
- //========================================================================================
- // class CChangeShapeCommand - Change shape attributes: color, pattern, render verb
- //========================================================================================
-
- class FW_CLASS_ATTR CChangeShapeCommand : public FW_CCommand
- {
- public:
-
- CChangeShapeCommand(Environment* ev,
- ODCommandID id,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection);
-
- virtual ~ CChangeShapeCommand();
-
- // --- Command overrides
- virtual void DoIt(Environment* ev); // Override
- virtual void UndoIt(Environment* ev); // Override
- virtual void RedoIt(Environment* ev); // Override
- virtual void SaveUndoState(Environment* ev); // Override
-
- protected:
-
- // --- Must be overridden
- virtual void DoChange(Environment* ev) = 0;
- virtual void UndoShape(Environment* ev, CBaseShape* shape, unsigned long index) = 0;
-
- void SelectChangedShapes(Environment* ev);
-
- protected:
- CDrawPart* fDrawPart;
- CDrawSelection* fDrawSelection;
- FW_CPrivOrderedCollection* fChangedShapeList;
- // list of shapes affected by command
- };
-
- //========================================================================================
- // CChangeColorCommand
- //========================================================================================
-
- class FW_CLASS_ATTR CChangeColorCommand : public CChangeShapeCommand
- {
- public:
-
- CChangeColorCommand(Environment* ev,
- ODCommandID commandID,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection,
- const FW_CColor& newColor);
-
- virtual ~ CChangeColorCommand();
-
- // --- CChangeShapeCommand overrides
- protected:
- virtual void DoChange(Environment* ev); // Override
- virtual void UndoShape(Environment* ev, CBaseShape* shape, unsigned long index); // Override
- public:
- virtual void SaveUndoState(Environment* ev); // Override
-
- protected:
- FW_CColor* fOldColors; // array of FW_CColor
- FW_CColor fNewColor;
- FW_Boolean fIsFill;
- };
-
- //========================================================================================
- // CChangePatternCommand
- //========================================================================================
-
- class FW_CLASS_ATTR CChangePatternCommand : public CChangeShapeCommand
- {
- public:
-
- CChangePatternCommand(Environment* ev,
- ODCommandID commandID,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection,
- const FW_PPattern& newPattern);
-
- virtual ~ CChangePatternCommand();
-
- // --- CChangeShapeCommand overrides
- protected:
- virtual void DoChange(Environment* ev); // Override
- virtual void UndoShape(Environment* ev, CBaseShape* shape, unsigned long index); // Override
-
- public:
- virtual void SaveUndoState(Environment* ev); // Override
-
- protected:
- FW_PPattern* fOldPatterns; // array of FW_PPattern
- FW_PPattern fNewPattern;
- unsigned short fCount;
- FW_Boolean fIsFill;
- };
-
- //========================================================================================
- // CChangeRenderVerbCommand
- //========================================================================================
-
- class FW_CLASS_ATTR CChangeRenderVerbCommand : public CChangeShapeCommand
- {
- public:
-
- CChangeRenderVerbCommand(Environment* ev,
- CDrawPart* part,
- FW_CFrame* frame,
- CDrawSelection* selection,
- unsigned short newRenderVerb);
-
- virtual ~ CChangeRenderVerbCommand();
-
- // --- CChangeShapeCommand overrides
- protected:
- virtual void DoChange(Environment* ev); // Override
- virtual void UndoShape(Environment* ev, CBaseShape* shape, unsigned long index); // Override
- public:
- virtual void SaveUndoState(Environment* ev); // Override
-
- private:
- unsigned short fNewRenderVerb;
- unsigned short* fOldRenderVerbs; // array of unsigned short
- };
-
-
-
- #endif
-